home *** CD-ROM | disk | FTP | other *** search
- #include "bctools.h"
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- #include <ctype.h>
-
-
- /***
- *
- * Function listfile : display a file on screen with pause
- * after each screen.
- *
- ***/
-
- int listfile( char *filename )
-
- { FILE *fp;
- char buffer[82];
- int line;
-
- if (! (fp = fopen(filename,"rb")) ) return -2;
-
- window( 1, 1, 80, 25 );
- clrscr();
-
- for ( line = 0; fgets(buffer, 81, fp); line ++ )
- {
- clreol();
- cputs( buffer );
- if ( line == 23 ) { gotoxy( 75, 25 );
- cputs( "<···>" );
- if ( getkey() == ESC ) return -1;
- gotoxy( 1, 25 ); clreol();
- line = 0;
- }
- }
-
- cputs( "\n\r" );
- if ( line != 1 ) { gotoxy( 75, 25 );
- cputs( "<···>" );
- if ( getkey() == ESC ) return -1;
- gotoxy( 1, 25 ); clreol();
- }
- fclose( fp );
-
- return 0;
- }
-